package com.example.blogother.controller;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
import com.example.blogother.mapper.FailMapper;
import com.xpd.blog.bean.Fail;
import com.xpd.blog.bean.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xpd
 * @since 2024-10-30
 */
@RestController
@RequestMapping("/fail")
public class FailController {
    @Autowired
    FailMapper failMapper;
    @RequestMapping("getFailByUsid")
    public Result getFailByUsid(@RequestParam int usid,@RequestParam int page,@RequestParam int size){
        LambdaQueryWrapper<Fail> lqw=new LambdaQueryWrapper<>();
        lqw.eq(Fail::getUsid,usid);
        List<Fail> fails = failMapper.selectByUsid(usid, ((page - 1) * size), size);
        return new Result(1,"查询成功",fails);
    }
}

